#include "tinyos.h"
#include "ARMCM3.h"
#include "cpu.h"

void system_tick_init(u32 ms)
{
    SysTick->LOAD = ms * SystemCoreClock / 1000;
    NVIC_SetPriority(SysTick_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
    SysTick->VAL = 0;
    SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk 
        | SysTick_CTRL_ENABLE_Msk;
}
